feat: Add AddNameToNullArgumentRector#8000
Conversation
|
Looks good, thank you |
|
Nice addition - is there a way of removing unnecessary parameters (because it's the default value) once a named argument has been introduced? e.g. This Rector made this change: -$table->addRow(null, $styles['cant-split']);
+$table->addRow(height: null, style: $styles['cant-split']);But we can go further: -$table->addRow(height: null, style: $styles['cant-split']);
+$table->addRow(style: $styles['cant-split']);(Ref: https://github.com/PHPOffice/PHPWord/blob/master/src/PhpWord/Element/Table.php#L67) |
|
@u01jmg3 there is https://getrector.com/demo/8186634c-2eb5-411d-8709-0f9d508924ab You can configure: <?php
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPreparedSets(codeQuality: true, deadCode: true); |
|
It looks like Rector (or PHPStan) is not able to infer this from PHPWord... |
|
@u01jmg3 Looks doable. |
Hello!
This is similar to #7944 but for null arguments. I refactored the core logic into a reusable service so that other rules can be easily added in the future
Thanks!